//
// Created by Administrator on 2025/4/26/周六.
//


#include "iostream"

using namespace std;

class Person {

    //友元
    friend ostream &operator<<(ostream &out, Person &p);

private:
    int m_A;
    int m_B;

public:
    Person(int a, int b) {
        this->m_A = a;
        this->m_B = b;
    }


};

//全局函数实现左移重载
//ostream 对象只能有一个
ostream &operator<<(ostream &out, Person &p) {
    out << "a :" << p.m_A << "b :" << p.m_B << endl;
    return out;
}

//
void test() {
    Person p1(10, 20);
    cout << p1 << "hello world" << endl; //链式编程
}

int main() {
    test();

}